<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>邮件服务</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="__LAYUIADMIN__/res/layui/css/layui.css" media="all">
</head>

<body>

    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-header">邮件服务</div>
                    <div class="layui-card-body">

                        <div class="layui-form" wid100 lay-filter="">
                            <div class="layui-form-item">
                                <label class="layui-form-label">SMTP 服务器</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="smtp_server" placeholder="smtp.domain.com"
                                        class="layui-input" value="{$data.smtp_server}">
                                </div>
                                <div class="layui-form-mid layui-word-aux">如：smtp.163.com</div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">SMTP 端口号</label>
                                <div class="layui-input-inline" style="width: 80px;">
                                    <input type="text" name="cache" lay-verify="number" value="{$data.cache}" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">一般为 25 或 465</div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">发件人邮箱</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="send_email" placeholder="name@domain.com"
                                        lay-verify="email" autocomplete="off" class="layui-input" value="{$data.send_email}">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">发件人昵称</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="send_nickname" value="{$data.send_nickname}" placeholder="nickname"
                                        autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">订单接收邮箱</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="receive_email" value="{$data.receive_email}" placeholder="nickname"
                                        autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">邮箱密码</label>
                                <div class="layui-input-inline">
                                    <input type="password" name="mail_pwd" value="{$data.mail_pwd}" placeholder="password"
                                        autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button class="layui-btn" lay-submit lay-filter="set_system_email">确认保存</button>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="__LAYUIADMIN__/res/layui/layui.js"></script>

    <script>
        layui.use(function () {
            var form = layui.form;
            var layer = layui.layer;
            var laydate = layui.laydate;
            var util = layui.util;
            $ = layui.$;
            // 提交事件
            form.on('submit(set_system_email)', function (data) {
                var field = data.field;
                $.post('/admin/system/update?conf=sys_mail', field, (res) => {
                    if (res.code == 200) {
                        layer.msg('修改成功')
                    } else {
                        layer.msg(res.msg)
                    }
                })
                return false;
            });


        });


    </script>

</html>